import request from "@/utils/request";
import getUserProfileName from "@/utils/getUserProfile";

// 查询今日销售总金额，总升数
export function listSum(query) {
  return request({
    url: "/station/order/selectDaySources",
    method: "get",
    params: query,
  });
}

// 查询今日销售总金额，总升数包括已经作废的订单
export async function listAllSum(query) {
  // 判断是否的admin 账号，如果不是，传 isDelete = 0 到后端，如果是则不用传参
  const isDelete = await getUserProfileName();
  let queryPlass;
  if (isDelete) {
    queryPlass = query;
  } else {
    queryPlass = { ...query, isDeleted: 0 };
  }
  return request({
    url: "/station/order/selectAllDaySources",
    method: "get",
    params: queryPlass,
  });
}

// 查询到款金额和充值金额
export function listReceiveAmt(query) {
  return request({
    url: "/station/order/selectReceiveDaySources",
    method: "get",
    params: query,
  });
}

//根据油品查询总的金额
export function listOilType(query) {
  return request({
    url: "/station/order/selectOilTypeSources",
    method: "get",
    params: query,
  });
}
``;
//根据油品查询总的金额（包括退款的信息）
export async function listAllOilType(query) {
  // 判断是否的admin 账号，如果不是，传 isDelete = 0 到后端，如果是则不用传参
  const isDelete = await getUserProfileName();
  let queryPlass;
  if (isDelete) {
    queryPlass = query;
  } else {
    queryPlass = { ...query, isDeleted: 0 };
  }

  return request({
    url: "/station/order/selectAllOilTypeSources",
    method: "get",
    params: queryPlass,
  });
}

//查询收入的金额展示
export function listViewData(query) {
  return request({
    url: "/station/order/selectOverViewData",
    method: "get",
    params: query,
  });
}
//查询收入的金额展示（包括退款）
export function listAllViewData(query) {
  return request({
    url: "/station/order/selectAllOverViewData",
    method: "get",
    params: query,
  });
}

// 查询订单支付详细
export function getOrder(orderId) {
  return request({
    url: "/station/order/" + orderId,
    method: "get",
  });
}

export function listDayReport(query) {
  return request({
    url: "/station/order/selectDayReport",
    method: "get",
    params: query,
  });
}
//查询本月的消费情况
export function selectDayReportDetail(query) {
  return request({
    url: "/station/order/selectDayReportDetail",
    method: "get",
    params: query,
  });
}
//查询本月的消费情况（包括已经退款的）
export async function selectAllDayReportDetail(query) {
  // 判断是否的admin 账号，如果不是，传 isDelete = 0 到后端，如果是则不用传参
  const isDelete = await getUserProfileName();
  let queryPlass;
  if (isDelete) {
    queryPlass = query;
  } else {
    queryPlass = { ...query, isDeleted: 0 };
  }

  return request({
    url: "/station/order/selectAllDayReportDetail",
    method: "get",
    params: queryPlass,
  });
}
//查询本天的消费情况
export function getDetails(query) {
  return request({
    url: "/station/order/dayOilTypeSources",
    method: "get",
    params: query,
  });
}
//查询本天的消费情况（包括已经退款的）
export async function getAllDetails(query) {
  // 判断是否的admin 账号，如果不是，传 isDelete = 0 到后端，如果是则不用传参
  const isDelete = await getUserProfileName();
  let queryPlass;
  if (isDelete) {
    queryPlass = query;
  } else {
    queryPlass = { ...query, isDeleted: 0 };
  }

  return request({
    url: "/station/order/dayAllOilTypeSources",
    method: "get",
    params: queryPlass,
  });
}
export function listQydata92(query) {
  return request({
    url: "/station/order/listQydata92",
    method: "get",
    params: query,
  });
}
export function listQydata95(query) {
  return request({
    url: "/station/order/listQydata95",
    method: "get",
    params: query,
  });
}
export function listQydata98(query) {
  return request({
    url: "/station/order/listQydata98",
    method: "get",
    params: query,
  });
}
export function listQydata0(query) {
  return request({
    url: "/station/order/listQydata0",
    method: "get",
    params: query,
  });
}
export function listQydata10(query) {
  return request({
    url: "/station/order/listQydata10",
    method: "get",
    params: query,
  });
}
export function listQydata20(query) {
  return request({
    url: "/station/order/listQydata20",
    method: "get",
    params: query,
  });
}
export function listXdata(query) {
  return request({
    url: "/station/order/listXdata",
    method: "get",
    params: query,
  });
}
//累计充值
export function listCZXFData(query) {
  return request({
    url: "/customer/record/listCZXFData",
    method: "get",
    params: query,
  });
}
//累计充值（包含退款金额）
export function listAllCZXFData(query) {
  return request({
    url: "/customer/record/listAllCZXFData",
    method: "get",
    params: query,
  });
}
//汇总电子卡
export function listHYData(query) {
  return request({
    url: "/customer/card/listHYData",
    method: "get",
    params: query,
  });
}

export function listJRHYData(query) {
  return request({
    url: "/customer/card/listJRHYData",
    method: "get",
    params: query,
  });
}

export function homeSumQuery(query) {
  return request({
    url: "/station/order/homeSumQuery",
    method: "get",
    params: query,
  });
}
export function employeePermission(query) {
  return request({
    url: "/station/order/employeePermission",
    method: "get",
    params: query,
  });
}

// 获取地区下的油企
export function getEnterpriseByDistrict(query) {
  return request({
    url: "/station/order/getEnterpriseByDistrict",
    method: "get",
    params: query,
  });
}

// 获取油企下的油站
export function getStationByEnterprise(query) {
  return request({
    url: "/station/order/getStationByEnterprise",
    method: "get",
    params: query,
  });
}
